'use strict';
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;

function resolve(dir) {
    return path.join(__dirname, '..', dir);
}

if (!fs.existsSync(resolve('mock'))) {
    exec('npm run mock:build', function (err, stdout, stderr) {
        if (err) {
            console.error(stderr);
        } else {
            console.log(stdout);
        }
    });
} else {
    exec('npm run mock:update', function (err, stdout, stderr) {
        if (err) {
            console.error(stderr);
        } else {
            console.log(stdout);
        }
    });
}


